package com.eazy.lksy.reptile;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.eazy.lksy.reptile.dao.AreaDao;
import com.eazy.lksy.reptile.dao.LineDao;
import com.eazy.lksy.utils.JsonKsy;
import com.eazy.lksy.utils.Unit;

public class CatchHotelInfo {

	static List<String> cityList = new ArrayList<String>(Arrays.asList("beijing_city","shanghai_city","guangzhou","shenzhen"));
	
	public static void main(String[] args) {
			String requestUrl = "http://lh.qunar.com/render/renderAPIList.jsp?showAllCondition=1&attrs=VAuXapLv,L0F4L3C1,ZO1FcGJH,YRHLp-jc,pk4QaDyF,TDoolO-H,IPh0IGUv,-VOoGRk2,08F7hM4i,HCEm2cI6,J6TkcChI,vNfnYBK6,2XkzJryU,Fre34fNr,HGYGeXFY,0Ie44fNU,dDjWmcqr,yYdMIL83,ownT_WG6,Y0LTFGFh,DEju23oi&showPromotion=1&cityurl=beijing_city&sort=SAVING&desc=1&fromDate=2016-02-20&toDate=2016-02-21&requestor=RT_LHLIST&filterid=9ab375d7-08e9-475f-80a1-f3e4376b0d7e&t=1455857296064&mixKey=0bc938cb953ef0d145585730019516L3XyVy2LGwiEOulfZcIVeP&__jscallback=XQScript_8";
			String data = Unit.getHtmlContent(requestUrl);
			//int key = getKey(cityList.get(i));
			String detail = JsonKsy.parseObj(data, "hotels");
			String [] attrs = JsonKsy.parseArr(detail, "attrs");
			for(String a : attrs) {
				System.out.println(a);
			}
	}
	
	// 判断城市id
	public static int getKey(String data) {
		int number = 0;
		switch (data) {
		case "beijing_city":
			number = 1;
			break;
		case "shanghai_city":
			number = 2;
			break;
		case "guangzhou":
			number = 3;
			break;
		case "shenzhen":
			number = 4;
			break;
		default:
			break;
		}
		return number;
	}
	

}
